from script.get_contest_info.config.nowcoder_config import nc_headers , nc_time
from urllib.parse import urlencode
from script.get_user_info.name.nowcoder import  nc_name
import requests
def nc_acm_response(contest_id,uid):
    name = nc_name(uid)
    base_url = "https://ac.nowcoder.com/acm-heavy/acm/contest/real-time-rank-data"
    params = {
        "token": "",
        "id": contest_id,
        "searchUserName": name ,
        "limit": 0,
        "_": nc_time,
        "contestList" : [str(contest_id)]
    }
    # 构建完整的URL
    url = base_url + "?" + urlencode(params)
    response =  requests.get(url=url,headers=nc_headers)
    return response.text

if __name__ == '__main__':
    print(nc_acm_response(70500,"785693755"))